﻿using System.Collections.Generic;
using System.Linq;
using LBoL.Base;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LBoL.Core.StatusEffects;
using LBoLEntitySideloader.Attributes;
using ProbeMod.Cards.Template;
using ProbeMod.StatusEffects;

namespace ProbeMod.Cards
{
    public sealed class ProbeTurtleStyleDef : ProbeCardTemplate
    {
        public override CardConfig MakeConfig()
        {
            CardConfig config = GetCardDefaultConfig();

            config.Rarity = Rarity.Uncommon;
            config.Type = CardType.Ability;
            config.TargetType = TargetType.Nobody;

            config.Colors = new List<ManaColor>() { ManaColor.Blue,ManaColor.White,ManaColor.Black };
            config.Cost = new ManaGroup() { Blue = 1, White = 1,Black=1, Any = 1 };
            config.UpgradedCost = new ManaGroup() { Blue = 1, White = 1,Black=1 };

            config.Value1 = 4;  // 火力灵力值

            config.Index = CardIndexGenerator.GetUniqueIndex(config);
            return config;
        }
    }

    /// <summary>
    /// 乌龟流
    /// 火力+3，灵力+3，你一回合只能出3张牌
    /// </summary>
    [EntityLogic(typeof(ProbeTurtleStyleDef))]
    public sealed class ProbeTurtleStyle : ProbeCard
    {
        public int Count
        {
            get => IsUpgraded ? Value1 + 1 : Value1;
        }

        protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
        {
            yield return new ApplyStatusEffectAction<ProbeTurtleStyleSe>(Battle.Player,limit:3);
            yield return BuffAction<Firepower>(Count);
            yield return BuffAction<Spirit>(Count);
        }
    }
}
